package com.serialcommunication.constants;

import java.util.ArrayList;
import java.util.List;

import org.apache.soap.encoding.Hex;

import com.serialcommunication.model.DynamicAction;
import com.serialcommunication.model.BinaryAction;

/**
 * Provides Command Object and helper functions to get right object
 * @author Alex
 *
 */
public class ActionConstants {
	
	/*
	 * ACTION DEFINTION: Normal 
	 */
	
	public static final DynamicAction TEST_LINK_OK = new DynamicAction("TEST_LINK_OK", "TEST_LINK_OK", "99", 24);
	public static final DynamicAction TEST_LINK_NOT_OK = new DynamicAction("TEST_LINK_NOT_OK", "TEST_LINK_NOT_OK", "98", 24);
	
	public static final DynamicAction X_TARGET = new DynamicAction("SXTARGET", "X_TARGET", "00", 24);
	public static final DynamicAction X_ACTUAL = new DynamicAction("X_ACTUAL", "X_ACTUAL", "01", 24);
	public static final DynamicAction V_MIN = new DynamicAction("V_MIN" ,"V_MIN", "02", 11);
	public static final DynamicAction V_MAX = new DynamicAction("V_MAX" ,"V_MAX", "03", 11);
	public static final DynamicAction V_TARGET = new DynamicAction("V_TARGET" ,"V_TARGET", "04", 12);
	public static final DynamicAction U_STEP_RESOLUTION = new DynamicAction("U_STEP_RESOLUTION" ,"uST_RES [mA]", "05", 5);
	public static final DynamicAction A_MAX = new DynamicAction("A_MAX" ,"A_MAX", "06", 11);
	
	public static final DynamicAction VOLTAGE = new DynamicAction("VOLTAGE" ,"VOLTAGE", "0C", 8);
	
	public static final DynamicAction MOTION_CURR = new DynamicAction("MOTION_CURR" ,"M_CURR [mA]", "XX", -1);
	public static final DynamicAction HOLD_CURR = new DynamicAction("HOLD_CURR" ,"H_CURR [mA]", "XX", -1);
	public static final DynamicAction WAIT_TIME = new DynamicAction("WAIT_TIME" ,"W_TIME [msec]", "XX", -1);
	
	
	/*
	 * ACTION DEFINTION: Binary (SET COMMANDS VON GUI)
	 */
	public static final BinaryAction LINK_OK = new BinaryAction("LINK_OK", "LINK_OK", "FD", 39); 
	public static final BinaryAction RAMP_MODE = new BinaryAction("RAMP_MODE", "RAMP_MODE", "FD", 30); // should be 38
	public static final BinaryAction RAMP_SOFT_MODE = new BinaryAction("RAMP_SOFT_MODE", "RAMP_SOFT_MODE", "FD", 29); // should be 37
	public static final BinaryAction VELOCITY_MODE = new BinaryAction("VELOCITY_MODE", "VELOCITY_MODE", "FD", 36); 
	public static final BinaryAction MOTOR_GO = new BinaryAction("MOTOR_GO", "MOTOR_GO", "FD", 35); 
	public static final BinaryAction MOTOR_GO_RPT = new BinaryAction("MOTOR_GO_RPT", "MOTOR_GO_RPT", "FD", 34); 
	public static final BinaryAction MOTOR_GO_RVS = new BinaryAction("MOTOR_GO_RVS", "MOTOR_GO_RVS", "FD", 33); 
	public static final BinaryAction MOTOR_STOP = new BinaryAction("MOTOR_STOP", "MOTOR_STOP", "FD", 32); 
	public static final BinaryAction MOTOR_STOP_CE = new BinaryAction("MOTOR_STOP_CE", "MOTOR_STOP_CE", "FD", 38); // should be 31
	public static final BinaryAction CHOPPER_MODE = new BinaryAction("CHOPPER_MODE", "CHOPPER_MODE", "FD", 30); 
	public static final BinaryAction SEIMIN = new BinaryAction("SEIMIN", "SEIMIN", "FD", 29); 
	public static final BinaryAction SET_FILTER = new BinaryAction("SET_FILTER", "SET_FILTER", "FD", 28); 
	public static final BinaryAction SET_STEP_INTERPOL = new BinaryAction("SET_STEP_INTERPOL", "SET_STEP_INTERPOL", "FD", 26); 
	public static final BinaryAction SET_NEW_REFERENZ = new BinaryAction("SET_NEW_REFERENZ", "SET_NEW_REFERENZ", "FD", 25); 
	public static final BinaryAction SET_MOTOR_ON = new BinaryAction("SET_MOTOR_ON", "SET_MOTOR_ON", "FD", 24); 
	public static final BinaryAction SET_WAIT_TIME = new BinaryAction("SET_WAIT_TIME", "SET_WAIT_TIME", "FD", 23); 
	
	/*
	 * ACTION DEFINTION: Binary (SET COMMANDS VON MODUL)
	 */
	public static final BinaryAction VOLTAGE_OUT_OF_RANGE = new BinaryAction("VOLTAGE_OUT_OF_RAGE", "VSOR", "FE", 39); 
	public static final BinaryAction RSR = new BinaryAction("RSR", "RSR", "FE", 38); // Status linker Referenz Schalter
	public static final BinaryAction RSL = new BinaryAction("RSL", "RSL", "FE", 37); // Status rechter Referenz Schalter
	public static final BinaryAction TARGET_POSITION_REACHED = new BinaryAction("TARGET_POSITION_REACHED", "xEQ", "FE", 36); // Status linker Referenz Schalter
	public static final BinaryAction OVER_TEMP_WARNING = new BinaryAction("OVER_TEMP_WARNING", "OTW", "FE", 35); 
	public static final BinaryAction OVER_TEMP_SHUTDOWN = new BinaryAction("OVER_TEMP_SHUTDOWN", "OTS", "FE", 34); 
	public static final BinaryAction MOTOR_BLOCKED = new BinaryAction("SET_WAIT_TIME", "STST", "FE", 33); 
	public static final BinaryAction MOTOR_NOT_MOVING = new BinaryAction("SET_WAIT_TIME", "SGS", "FE", 32); 
	public static final BinaryAction TRANSMIT_ERROR = new BinaryAction("TRANSMIT_ERROR", "ERR", "FE", 8); 
	
	/*
	 * LIST DEFINITION
	 */
	public static List<DynamicAction> ACTION_LIST = new ArrayList<DynamicAction>() ;
	public static List<BinaryAction> BINARY_ACTION_LIST = new ArrayList<BinaryAction>() ;
	
	static {
		ACTION_LIST.add(TEST_LINK_NOT_OK);
		ACTION_LIST.add(TEST_LINK_OK);
		ACTION_LIST.add(X_TARGET);
		ACTION_LIST.add(X_ACTUAL);
		ACTION_LIST.add(V_MIN);
		ACTION_LIST.add(V_MAX);
		ACTION_LIST.add(V_TARGET);
		ACTION_LIST.add(U_STEP_RESOLUTION);
		ACTION_LIST.add(A_MAX);
		
		BINARY_ACTION_LIST.add(LINK_OK);
		BINARY_ACTION_LIST.add(RAMP_MODE);
		BINARY_ACTION_LIST.add(RAMP_SOFT_MODE);
		BINARY_ACTION_LIST.add(VELOCITY_MODE);
		BINARY_ACTION_LIST.add(MOTOR_GO);
		BINARY_ACTION_LIST.add(MOTOR_GO_RPT);
		BINARY_ACTION_LIST.add(MOTOR_GO_RVS);
		BINARY_ACTION_LIST.add(MOTOR_STOP);
		BINARY_ACTION_LIST.add(MOTOR_STOP_CE);
		BINARY_ACTION_LIST.add(CHOPPER_MODE);
		BINARY_ACTION_LIST.add(SEIMIN);
		BINARY_ACTION_LIST.add(SET_FILTER);
		BINARY_ACTION_LIST.add(SET_STEP_INTERPOL);
		BINARY_ACTION_LIST.add(SET_NEW_REFERENZ);
		BINARY_ACTION_LIST.add(SET_MOTOR_ON);
		BINARY_ACTION_LIST.add(SET_MOTOR_ON);
		BINARY_ACTION_LIST.add(VOLTAGE_OUT_OF_RANGE);
		BINARY_ACTION_LIST.add(RSR);
		BINARY_ACTION_LIST.add(RSL);
		BINARY_ACTION_LIST.add(TARGET_POSITION_REACHED);
		BINARY_ACTION_LIST.add(OVER_TEMP_WARNING);
		BINARY_ACTION_LIST.add(OVER_TEMP_SHUTDOWN);
		BINARY_ACTION_LIST.add(MOTOR_BLOCKED);
		BINARY_ACTION_LIST.add(MOTOR_NOT_MOVING);
		BINARY_ACTION_LIST.add(TRANSMIT_ERROR);
	}
}
